package cn.wolfcode.service.impl;


import cn.wolfcode.domain.Employee;
import cn.wolfcode.mapper.EmployeeMapper;
import cn.wolfcode.service.ILoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LogainServiceImpl implements ILoginService {
    @Autowired
    private EmployeeMapper employeeMapper;

    @Override
    public Employee logain(String username, String password) {
        if (username==null){
            throw new RuntimeException("用户名不能为空");
        }
        Employee employee = employeeMapper.login(username, password);
        if (employee==null){
            throw new RuntimeException("用户名或密码错误");
        }
        return employee;
    }
}
